package com.nubaseg.parser;

/**
 * Created with IntelliJ IDEA.
 * User: Nubaseg
 * Date: 20.10.13
 * Time: 2:46
 */
public class Operator extends Token {

    public enum OperatorType {PLUS, MINUS, DIV, MUL};


    private OperatorType type;
    private int precedence;

    public Operator(String strValue) {
        super(strValue);


        if (type == OperatorType.PLUS || type == OperatorType.MINUS)
            precedence = 2;
        else if (type == OperatorType.DIV || type == OperatorType.MUL)
            precedence =  3;
    }

    @Override
    public TokenType getType() {
        return TokenType.OPERATOR;
    }

    public OperatorType getOperatorType() {
        return type;
    }

    public int getPrecedence() {
        return precedence;
    }
}
